import { axios } from '@/utils/request'

const serverPath = '/core'

const api = {
  getListTreeByPid: serverPath + '/interface/administrativeDivision/getListTreeByPid', // 根据iid获取子行政区划列表(树)
  getListByPid: serverPath + '/interface/administrativeDivision/getListByPid', // 根据iid获取子行政区划列表
  modify: serverPath + '/interface/administrativeDivision/modify', // 修改行政区划信息
  add: serverPath + '/interface/administrativeDivision/add', // 新增行政区划信息
  remove: serverPath + '/interface/administrativeDivision/remove' // 删除行政区划信息
}


export const divisonApi = {
  getListTreeByPid (parameter) {
    return axios({
      url: api.getListTreeByPid,
      method: 'POST',
      data: parameter
    })
  },
  getListByPid (parameter) {
    return axios({
      url: api.getListByPid,
      method: 'POST',
      data: parameter
    })
  },
  modify (parameter) {
    return axios({
      url: api.modify,
      method: 'POST',
      data: parameter,
      headers: {
        'Content-Type': 'application/json'
      }
    })
  },
  add (parameter) {
    return axios({
      url: api.add,
      method: 'POST',
      data: parameter,
      headers: {
        'Content-Type': 'application/json'
      }
    })
  },
  remove (parameter) {
    return axios({
      url: api.remove,
      method: 'POST',
      data: parameter,
      headers: {
        'Content-Type': 'application/json'
      }
    })
  }
}
